Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sendgrid/helpers

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sendgrid/helpers

Twilio SendGrid NodeJS internal helpers

  • 7.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
594K
decreased by-55.35%
Maintainers
1
Weekly downloads
 
Created

What is @sendgrid/helpers?

@sendgrid/helpers is a utility library for the SendGrid API that provides helper functions to simplify the process of building and sending emails, managing contacts, and handling other email-related tasks.

What are @sendgrid/helpers's main functionalities?

Building and Sending Emails

This feature allows you to build and send emails using the SendGrid API. The code sample demonstrates how to set up the API key, create an email message, and send it.

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
  to: 'test@example.com',
  from: 'test@example.com',
  subject: 'Sending with SendGrid is Fun',
  text: 'and easy to do anywhere, even with Node.js',
  html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
sgMail.send(msg).then(() => {
  console.log('Email sent');
}).catch((error) => {
  console.error(error);
});

Managing Contacts

This feature allows you to manage contacts in your SendGrid account. The code sample demonstrates how to add a contact using the SendGrid API.

const sgClient = require('@sendgrid/client');
sgClient.setApiKey(process.env.SENDGRID_API_KEY);
const request = {
  method: 'PUT',
  url: '/v3/marketing/contacts',
  body: {
    contacts: [
      {
        email: 'test@example.com',
        first_name: 'Test',
        last_name: 'User'
      }
    ]
  }
};
sgClient.request(request).then(([response, body]) => {
  console.log(response.statusCode);
  console.log(body);
}).catch((error) => {
  console.error(error);
});

Handling Email Templates

This feature allows you to create and manage email templates. The code sample demonstrates how to create a new email template using the SendGrid API.

const sgClient = require('@sendgrid/client');
sgClient.setApiKey(process.env.SENDGRID_API_KEY);
const request = {
  method: 'POST',
  url: '/v3/templates',
  body: {
    name: 'Example Template'
  }
};
sgClient.request(request).then(([response, body]) => {
  console.log(response.statusCode);
  console.log(body);
}).catch((error) => {
  console.error(error);
});

Other packages similar to @sendgrid/helpers

FAQs

Package last updated on 18 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc